<?php
/**
 * com_bib      Developed using Nooku Framework 0.7 (see README.php for revision number)
 * @package		Bib
 * @copyright   Copyright (C) 2009 Danny Buytaert. All rights reserved.
 * @license     http://www.gnu.org/copyleft/gpl.html GNU/GPLv2
 */

//View helper for creating different select lists

class ComBibHelperSelect extends KObject
{
    
		public function genres($selected = 0)
	{
		$emtpy = new stdClass;
		$empty->id = 0;
		$empty->name = '- '.JText::_('Select genre').' -';
		$list = array($empty);
		foreach(KFactory::get('admin::com.bib.model.genres')->set('order', 'name')->getList() as $item)
		{
			$list[] = $item;
		}
		//genericlist( $arr, $name, $attribs = null, $key = 'value', $text = 'text', $selected = NULL, $idtag = false, $translate = false )
		return KTemplate::loadHelper('select.genericlist', $list, 'bib_genre_id', null, 'id', 'name', $selected, 'bib_genre_id');
	}
	
		public function authors($selected = 0)
	{
		$emtpy = new stdClass;
		$empty->id = 0;
		$empty->name = '- '.JText::_('Select author').' -';
		$list = array($empty);
		foreach(KFactory::get('admin::com.bib.model.authors')->set('order', 'name')->getList() as $item)
		{
			$list[] = $item;
		}
		//genericlist( $arr, $name, $attribs = null, $key = 'value', $text = 'text', $selected = NULL, $idtag = false, $translate = false )
		return KTemplate::loadHelper('select.genericlist', $list, 'bib_author_id', null, 'id', 'name', $selected, 'bib_author_id');
	}
	
}